// Author: Ivan Kazmenko (gassa@mail.ru)
module solution;
import std.math;
import std.stdio;
import std.typecons;

immutable int dirs = 4;
immutable int [dirs] dx = [-1,  0, +1,  0];
immutable int [dirs] dy = [ 0, -1,  0, +1];

struct Point
{
	int x;
	int y;
}

Point transform (Point a)
{
	return Point (((a.x - a.y) & ~1) / 2, a.y);
}

void main ()
{
	Point p, q;
	while (readf (" %s %s %s %s", &p.x, &p.y, &q.x, &q.y) > 0)
	{
		Point [] r;
		int [Point] d;
		r ~= p;
		d[p] = 0;
		while (q !in d)
		{
			auto v = r[0];
			auto tv = transform (v);
			r = r[1..$];
			int cur = d[v];
			foreach (dir; 0..dirs)
			{
				auto u = Point (v.x + dx[dir], v.y + dy[dir]);
				auto tu = transform (u);
				auto next = cur + (tu != tv);
				if (u !in d || d[u] > next)
				{
					d[u] = next;
					if (tu == tv)
					{
						r = [u] ~ r;
					}
					else
					{
						r = r ~ [u];
					}
				}
			}
		}
		writeln (d[q]);
	}
}
